import 'package:flutter/material.dart';
import 'package:flutter_example/pages/home_page.dart';
import 'package:flutter_example/pages/message_page.dart';
import 'package:flutter_example/pages/my_page.dart';
import 'package:flutter_example/pages/service_page.dart';

class TabNavigatorV2 extends StatefulWidget {
  @override
  _TabNavigatorV2State createState() => _TabNavigatorV2State();
}

class _TabNavigatorV2State extends State<TabNavigatorV2> {
  int _currentIndex = 0;
  void _onTapChanged(int index) {
    setState(() {
      _currentIndex = index;
    });
  }

  List<Widget> list = [
    HomePage(title: "首页"),
    ServicePage(title: "服务"),
    MessagePage(title: "消息"),
    MyPage(title: "我的"),
  ];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      bottomNavigationBar: BottomAppBar(
        color: Colors.teal,
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceAround,
          children: [
            IconButton(icon: Icon(Icons.home), onPressed: () {}),
            Container(
              child: Column(
                mainAxisSize: MainAxisSize.min,
                children: [
                  Padding(
                    padding: const EdgeInsets.only(top: 3),
                    child: SizedBox(
                      width: 23,
                      height: 23,
                      child: ColoredBox(color: Colors.red),
                    ),
                  ),
                  Padding(
                    padding: const EdgeInsets.only(top: 2, bottom: 3),
                    child: Text(
                      "邻居家",
                      maxLines: 1,
                      overflow: TextOverflow.ellipsis,
                      style: TextStyle(fontSize: 10),
                      textScaleFactor: 1.0,
                    ),
                  ),
                ],
              ),
            ),
          ],
        ),
      ),
    );
  }

  void a() {}
}

/*
Tab
  距顶部：6pt
  头部图标：w=h=23pt
  之间间距：4pt
  底部文字： size=10pt，
  距底部：6pt
 */
